package com.good.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @author ieei
 *
 */
@Entity
@Table(name="xx_test1",schema="learn")
@SequenceGenerator(name="myGenerator",sequenceName="xx_test_generator")
@NamedQuery(name="myNamedQuery",query="SELECT t FROM Test1 t where t.name=:name")
public class Test1 extends BaseEntity{

	/**
	 * 
	 */
	public enum Good{
		RED,GREEN
	}
	private static final long serialVersionUID = 1L;
	private String name;
	private Test2 test2;
	private Good good;
	public Good getGood() {
		return good;
	}
	public void setGood(Good good) {
		this.good = good;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumns({@JoinColumn(name="TEST2_ID",referencedColumnName="id"),@JoinColumn(name="TEST2_NAME",referencedColumnName="name")})
	public Test2 getTest2() {
		return test2;
	}
	public void setTest2(Test2 test2) {
		this.test2 = test2;
	}

}
